package threadcoreknowledge.createthread.stopthread;

/**
 * 模拟连队领取武器
 */
public class StopThread implements Runnable {

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new StopThread());
        thread.start();
        Thread.sleep(500);
        thread.stop();
    }

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println("连队"+i+"开始领取武器");
            for (int j = 0; j < 10; j++) {
                System.out.println(j);
                try {
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("连队"+i+"已经领取完毕");
        }
    }
}
